﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="PC_UnPushWait.aspx.cs" Inherits="PMS.WaitDealUI.PC_UnPushWait" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var DealId = com.get.DealId;
            $("#tbList").datagrid({
                url: '/Logic/CommonAjax/WaitDealAjax.aspx?method=CommonWaitDealList',
                loadMsg: '数据加载中请稍后……',
                fitColumns: true,
                rownumbers: true,
                idField: "ID",
                singleSelect: false,
                queryParams: { DealId: DealId },
                striped: true,
                frozenColumns: [[{ field: 'ck', checkbox: true, width: 30 },
                 { field: 'ID', title: 'ID ', align: "center" },
                 //{ field: 'DemandPlanId', title: '计划主表ID ', align: "center" },
                // { field: 'DemandPlanInfoId', title: '计划分表ID ', align: "center" },
                 { field: 'PlanTrackId', title: '计划跟踪号 ', align: "center" },
                 { field: 'Tuhao', title: '图号/标识号 ', align: "center" },
                 { field: 'MaterialCode', title: '物料编码 ', align: "center" },
                 { field: 'MaterialName', title: '物料名称 ', align: "center" }, ]],
                columns: [[
                 { field: 'MaterialGuige', title: '规格 ', align: "center" },
                 { field: 'MaterialCaizhi', title: '材质 ', align: "center" },
                 { field: 'MaterialGB', title: '国标 ', align: "center" },
                 { field: 'MaterialType', title: '材料类型 ', align: "center" },
                 { field: 'MaterialLength', title: '长 ', align: "center" },
                 { field: 'MaterialWidth', title: '宽 ', align: "center" },
                 { field: 'DemandNum', title: '需用数量 ', align: "center" },
                 { field: 'DemandAidNum', title: '需用辅助数量 ', align: "center" },
                 { field: 'PcPlanNum', title: '采购数量 ', align: "center", },
                 { field: 'PurchaseUnit', title: '单位', align: "center" },
                 { field: 'PcPlanAidNum', title: '采购辅助数量 ', align: "center", },
                 { field: 'PurchaseAidUnit', title: '辅助单位', align: "center" },
                 { field: 'DepName', title: '使用部门', align: "center" },
                 { field: 'ApplyName', title: '申请人', align: "center" },
                 { field: 'ApplyDate', title: '制单日期 ', align: "center" },
                 {
                     field: 'State', title: '总状态 ', align: "center", formatter: function (value, row, Index) {
                         return com.getArrayText(StaticCombo.PcDemandPlanState, value);
                     }
                 },
                 {
                     field: 'ReplaceState', title: '代用状态 ', align: "center", formatter: function (value, row, Index) {
                         return com.getArrayText(StaticCombo.replaceState, value);
                     }
                 },
               { field: 'Note', title: '备注 ', align: "center" }, ]]
            });
        });
        //下推
        function funcPushdown() {

            var rows = $("#tbList").datagrid("getSelections");
            var n = 0;
            if (rows) {
                for (var i = 0; i < rows.length; i++) {
                    if (rows[i].State == 0) {
                        n++;
                    }
                    else {
                        com.message("information", "下推只能针对初始化状态");
                        return;
                    }
                }
                if (n == rows.length) {
                    var oId = { planinfo: JSON.stringify(rows) };
                    com.ajax({
                        url: '/Logic/PC/PC_DemandPlanAjax.aspx?method=PushDemondPlan',
                        data: oId,
                        success: function (data) {
                            com.message('success', data.msg, function () {
                                $("#tbList").datagrid("reload");
                                $("#tbList").datagrid("unselectAll");
                            });
                        }
                    })
                }
            }
            else {
                com.message("information", "请至少选中一行");
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
    <a href="javascript:void(0)" id="push" class="easyui-linkbutton" onclick="funcPushdown()"
        data-options="iconCls:'icon-arrow_se',plain:true">下推</a> &nbsp;&nbsp;
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <table id="tbList" title="需用计划表--待下推" style="width: 100%; height: 360px">
    </table>
</asp:Content>
